package cfgs.gestudent.finestra.preferencies;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Image;
import java.util.ResourceBundle;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;

import cfgs.gestudent.preferencies.ConfiguracionsIdiomes;

import javax.swing.JLabel;

import java.awt.Color;
import java.awt.Font;

import javax.swing.SwingConstants;
import javax.swing.JTextArea;

public class SobreGeStudent extends JDialog {

	private final JPanel contentPanel = new JPanel();
	
	private ConfiguracionsIdiomes configs = new ConfiguracionsIdiomes();
	private ResourceBundle rb = configs.getIdioma();

	/**
	 * Create the dialog.
	 */
	public SobreGeStudent() {
		setBounds(100, 100, 450, 300);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBackground(Color.WHITE);
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		
		setTitle(rb.getString("titolSobre"));
		
		setResizable(false);
		
		
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}
		
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		
		JLabel lblImatge = new JLabel("lblImatge");
		lblImatge.setBounds(10, 11, 75, 75);
		ImageIcon fot = new ImageIcon("img/favicon.jpg");
		Icon icon = new ImageIcon(fot.getImage().getScaledInstance(lblImatge.getWidth(), lblImatge.getHeight(), Image.SCALE_DEFAULT));
		lblImatge.setIcon(icon);
		contentPanel.add(lblImatge);
		
		JLabel lblTitol = new JLabel(rb.getString("titolSobre2"));
		lblTitol.setForeground(new Color(223, 127, 31));
		lblTitol.setFont(new Font("Tahoma", Font.BOLD, 34));
		lblTitol.setBounds(95, 11, 339, 59);
		contentPanel.add(lblTitol);
		
		JLabel lblVersio = new JLabel(rb.getString("versio"));
		lblVersio.setFont(new Font("Tahoma", Font.BOLD, 14));
		lblVersio.setBounds(95, 72, 339, 14);
		contentPanel.add(lblVersio);
		
		JLabel lblCopyright = new JLabel(rb.getString("copyright"));
		lblCopyright.setHorizontalAlignment(SwingConstants.RIGHT);
		lblCopyright.setBounds(95, 246, 339, 14);
		contentPanel.add(lblCopyright);
		
		JTextArea textArea = new JTextArea();
		textArea.setFont(new Font("Tahoma", Font.PLAIN, 11));
		textArea.setText(rb.getString("explicacio"));
		textArea.setLineWrap(true);
		textArea.setWrapStyleWord(true);
		textArea.setEditable(false);
		textArea.setBounds(95, 97, 339, 138);
		contentPanel.add(textArea);
	}
}
